<template>
  <div class="app-container">
     <!-- 搜索表单 -->
     <!-- <el-form :inline="true" :model="queryParams" class="demo-form-inline" >
      <el-form-item label="开始日期">
        <el-date-picker v-model="queryParams.startDate" type="date" placeholder="选择日期" value-format="YYYY-MM-DD"
           @change="handleQuery" />
      </el-form-item>
      <el-form-item label="结束日期">
        <el-date-picker v-model="queryParams.endDate" type="date" placeholder="选择日期"  value-format="YYYY-MM-DD"
          @change="handleQuery" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="handleQuery" v-hasPermi="['system:bills:query']">搜索</el-button>
      </el-form-item>
    </el-form> -->
    <el-table v-loading="loading" :data="tableData" style="width: 100%" max-height="500" stripe
      :cell-style="{ padding: '20px' }" :header-cell-style="{
        
        height: '100px',
        color: '#000000',
      }" class="className">
      <el-table-column prop="project_no" width="180" label="项目编号" align="center" />
      <el-table-column prop="settlement_month" width="180" label="结算月份" align="center" />
      <el-table-column prop="complete_month" width="180" label="完井月份" align="center" />
      <el-table-column prop="complete_month" width="180" label="是否完井" align="center" >
        <template #default="scope">
          {{ scope.row.complete_month?'是': '否'}}
        </template>
      </el-table-column>
      <el-table-column prop="dept_name" width="180" label="分公司" align="center" />
      <el-table-column prop="dept_three_name" width="180" label="施工单位" align="center" />
      <el-table-column prop="well_no" width="180" label="井号" align="center" />
      <el-table-column prop="construction_name" width="180" label="施工类别" align="center" />
      <el-table-column prop="construction_content" width="180" label="施工内容" align="center" />
      <el-table-column prop="paymentdept_name" width="180" label="结算单位" align="center" />
      <el-table-column prop="construction_address" width="180" label="施工地点" align="center" >
        <template #default="scope">
          <dict-tag :options="construction_address" :value="scope.row.construction_address" />
        </template>
      </el-table-column>
      <el-table-column prop="start_time" width="180" label="开工日期" align="center" />
      <el-table-column prop="complete_month" width="180" label="完工日期" align="center" />
      <el-table-column prop="construction_days" width="180" label="施工天数" align="center" />
      <el-table-column prop="income" width="180" label="一线作业收入" align="center" />
      <el-table-column v-for="(item, index) in tableColumn" :prop="item.id" width="155" :label="item.accountName"
        align="center">
      </el-table-column>
    </el-table>
  </div>
</template>

<script setup>
import { ElMessage, ElMessageBox } from "element-plus";
import { ref, reactive } from "vue";
import {
  listManagement,
  listManagementAll,
} from "@/api/cost/Operation";

// 字典引入
const { proxy } = getCurrentInstance();
const { construction_address, orgtype_dept } = proxy.useDict('construction_address', 'orgtype_dept');

// 表格数据
const tableData = ref([]);
const tableColumn = ref([]);
const loading = ref(false);


const queryParams = ref({
  startDate:'',
  endDate:''
});


//获取列表列头数据
const getList = () => {
  loading.value = true;
  // 列表数据
  listManagement()
    .then((res) => {
      tableData.value = res.data;
      loading.value = false;
    })
    .catch((error) => {
      console.log(error);
    });

};

const getColumn = ()=>{
  // 列头数据
  listManagementAll()
    .then((res) => {
      tableColumn.value = res.data;
    })
    .catch((error) => {
      console.log(error);
    });
}
/**导出按钮操作 */
function handleExport() {
  proxy.download(
    "/system/management/export",
    {
      ...queryParams.value,
    },
    `项目列表.xlsx`
  );
}

//查询列表
const handleQuery = () => {
console.log(queryParams.value);
  // getList();
};

getList();
getColumn()
</script>

<style lang="scss" scoped>
.app-container h2 {
  color: #1890FF;
  margin: 20px 0;
}

.el-row {
  margin-bottom: 20px;
}

.className :empty::before {
  content: "--";
  color: gray;
}

.search-form {
  padding-left: 20px;
}

.el-width {
  width: 340px;
}
</style>
